package com.team233.zuccecho.rabbitMQ;

import com.team233.zuccecho.service.impl.FeedbackImpl;
import com.team233.zuccecho.service.inter.FeedbackInterface;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Locale;

/**
 * @author pengbin
 * @version 1.0
 */
@RabbitListener(queues = "#{topicTimeStatQue.name}")
public class TopicTimeConsumer {
    @Autowired
    private FeedbackInterface feedbackInterface;
    private final Logger logger = LoggerFactory.getLogger(TopicTimeConsumer.class);
    private String name = "TopicTimeConsumer";

    @RabbitHandler
    public void handleMsg(ZuccEchoMessage msg){
        String time= (String) msg.getContent().get("msg");
        int num=feedbackInterface.summaryByTime(time);
        System.out.println(this.name+"summary result: "+num);
    }
}
